package cn.edu.neusoft.wuguangsheng.flowerimpression.activity;

import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.view.View;
import android.widget.ImageView;
import android.widget.Toast;

import java.util.List;

import cn.edu.neusoft.wuguangsheng.flowerimpression.R;
import cn.edu.neusoft.wuguangsheng.flowerimpression.adapter.EmptyRecyclerView;
import cn.edu.neusoft.wuguangsheng.flowerimpression.adapter.MyAskListAdapter;
import cn.edu.neusoft.wuguangsheng.flowerimpression.bean.AskBean;
import cn.edu.neusoft.wuguangsheng.flowerimpression.listener.ListListener;
import cn.edu.neusoft.wuguangsheng.flowerimpression.model.GetMyAskListModel;

public class UserAskActivity extends BaseActivity {
    EmptyRecyclerView userasklist_rv;
    private List<AskBean> items;
    View userasklist_emptyview;
    ImageView userasklist_fh;

    @Override
    void initView() {
        setLayout_file(R.layout.activity_user_ask);
        userasklist_rv = (EmptyRecyclerView)findViewById(R.id.userasklist_rv);
        userasklist_emptyview = (View)findViewById(R.id.userasklist_emptyview);
        userasklist_fh = (ImageView)findViewById(R.id.userasklist_fh);

        GetMyAskListModel getMyAskListModel = new GetMyAskListModel();
        getMyAskListModel.getMyAskList(getid(), new ListListener<AskBean>() {
            @Override
            public void onResponse(List<AskBean> list) {
                LinearLayoutManager linearLayoutManager=new LinearLayoutManager(UserAskActivity.this);
                linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
                userasklist_rv.setLayoutManager(linearLayoutManager);
                items=list;
                MyAskListAdapter myAskListAdapter=new MyAskListAdapter(UserAskActivity.this,items,R.layout.delete_ask_item);
                userasklist_rv.setAdapter(myAskListAdapter);
                userasklist_rv.setItemAnimator(new DefaultItemAnimator());
                userasklist_rv.setEmptyView(userasklist_emptyview);
            }

            @Override
            public void onFail(String msg) {
                Toast.makeText(UserAskActivity.this,"111",Toast.LENGTH_SHORT).show();
            }
        });
    }

    @Override
    void initEvent() {
        userasklist_fh.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
    }

    @Override
    void initDate() {

    }
}
